<!--
/**************************************************
* @ emgyorderconfirm.jsp
*
* Copyright   2006 Hitrust Technology Inc.
* Developed by SDC, Hitrust.
* All Rights Reserved.
*
* Modify History:
*  v1.00, 2006/04/17, Jenny Li
*  1) first release
/**************************************************
-->
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ include file="../../common.jsp" %>
<%@ taglib uri="/page.util.gs.hitrust.com/taglibs/page" prefix="page"%>
<html>
<head>
<title>订单查询</title>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<LINK href="<%=root%>/css/caigouxitong.css"" type=text/css rel=stylesheet>
<SCRIPT language="JavaScript" src="<%=root%>/js/common.js"></SCRIPT>
<SCRIPT language="JavaScript" src="<%=root%>/js/calendar.js"></SCRIPT>
<SCRIPT language="JavaScript" src="<%=root%>/js/hi-check.js"></SCRIPT>
<SCRIPT language="JavaScript" src="<%=root%>/js/string.js"></SCRIPT>
<%
	HashMap tMap = (HashMap)request.getAttribute("orderdept");
	ArrayList tOrderDeptList = (ArrayList)tMap.get("organization");
	ArrayList tManuf1 = (ArrayList) request.getAttribute("manufacture1");
	HashMap tMap1 = (HashMap) request.getAttribute("manufacturetyp2");
	HashMap tMap2 = (HashMap) request.getAttribute("manufacturetyp3");
	ResultProcess tOrder = (ResultProcess)request.getAttribute("order");
	String isRequery  = (String)request.getAttribute("requery");
	ArrayList tList = new ArrayList();
%>
<script>

function change1(optval){
  var val = optval;
  if(val=='0'){
    var listbox = document.getElementById("manuftype2");
    listbox.length = 0;
    var option = new Option();
    option.text = "---二级---";
    option.value = "0";
    listbox.options[listbox.length] = option;
    change2(optval);
  }else{
      var counter="0";
    <%if(tMap1 !=null){
      Collection tCollection = tMap1.keySet();
      Iterator tIterator = tCollection.iterator();
      while(tIterator.hasNext()){
        String tKey = (String)tIterator.next();
        tList = (ArrayList)tMap1.get(tKey);%>
        if(val == '<%=tKey%>'){
		  counter = "1";
          var listbox = document.getElementById("manuftype2");
          listbox.length = 0;
          var option = new Option();
          option.value = "0";
          option.text = "---二级---";
          listbox.options[listbox.length] = option;
          <%
	          	for(int n=0;n<tList.size();n++){
		            GSManufactureCategoryBean tGSManufactureBean = (GSManufactureCategoryBean)tList.get(n);
		            String categoryId = tGSManufactureBean.getGs_manufacture_category_id();
		            String categoryName = tGSManufactureBean.getGs_manufacture_category_name();%>
		            var temp1 = '<%=categoryId%>';
		            var temp2 = '<%=categoryName%>';
		            var option = new Option();
		            option.value = temp1;
		            option.text = temp2;
		            listbox.options[listbox.length] = option;
           <%
	       		}
           %>
			change2('0');           
         }
         
    <%
    	}
    %>
    	if(counter == '0'){
          var listbox = document.getElementById("manuftype2");
          listbox.length = 0;
          var option = new Option();
          option.value = "0";
          option.text = "---二级---";
          listbox.options[listbox.length] = option;  
          change2('0');    	
    	}
    <%  
    }
    %>
   }
}
    function change2(optval){
      var val = optval;
      if(val=='0'){
        var listbox = document.getElementById("manuftype3");
        listbox.length = 0;
        var option = new Option();
        option.text = "---三级---";
        option.value = "0";
        listbox.options[listbox.length] = option;

      }else{
      	var counter = "0";
        <%if(tMap2 !=null){
          Collection tCollection = tMap2.keySet();
          Iterator tIterator = tCollection.iterator();
          while(tIterator.hasNext()){
            String tKey = (String)tIterator.next();
            tList = (ArrayList)tMap2.get(tKey);%>
            if(val == '<%=tKey%>'){
              counter = "1";
              var listbox = document.getElementById("manuftype3");
              listbox.length = 0;
              var option = new Option();
              option.text = "---三级---";
              option.value = "0";
              listbox.options[listbox.length] = option;
              <%for(int n=0;n<tList.size();n++){
                GSManufactureCategoryBean tGSManufactureBean = (GSManufactureCategoryBean)tList.get(n);
                String categoryId = tGSManufactureBean.getGs_manufacture_category_id();
                String categoryName = tGSManufactureBean.getGs_manufacture_category_name();%>
                var temp1 = '<%=categoryId%>';
                var temp2 = '<%=categoryName%>';
                var option = new Option();
                option.value = temp1;
                option.text = temp2;
                listbox.options[listbox.length] = option;
                <%}%>
              }
          <%
          }
          %>
          if(counter == '0'){
		        var listbox = document.getElementById("manuftype3");
		        listbox.length = 0;
		        var option = new Option();
		        option.text = "---三级---";
		        option.value = "0";
		        listbox.options[listbox.length] = option;          
          }
          <%
            }%>
          }
        }	
	function process(val){
		if(val == 'Q'){
			var tStr = "";
			var tEnd = "";
			if(!isEmpty(emergyorderform.orderCreateDateStr.value)){
				tStr = emergyorderform.orderCreateDateStr.value.substr(0,4) + emergyorderform.orderCreateDateStr.value.substr(5,2) + emergyorderform.orderCreateDateStr.value.substr(8,2);

			}
			if(!isEmpty(emergyorderform.orderCreateDateEnd.value)){
				tEnd = emergyorderform.orderCreateDateEnd.value.substr(0,4) + emergyorderform.orderCreateDateEnd.value.substr(5,2) + emergyorderform.orderCreateDateEnd.value.substr(8,2);
			}
			if(parseInt(tStr) > parseInt(tEnd)){
					alert("订单创建周期的开始日期不能大于截止日期！");
					return false;
			}
			emergyorderform.action = "<%=response.encodeURL(root + "/A160302.do")%>";
    		emergyorderform.submit();			
		}else if(val == 'C'){
			emergyorderform.orderDeptId.value="0000";
			emergyorderform.deliverGoodsId.value = "";
			emergyorderform.type.value="0";
			emergyorderform.providerName.value="";
			emergyorderform.manuftype1.value="0";			
		    listbox = document.getElementById("manuftype2");
		    listbox.length = 0;
		    var option = new Option();
		    option.text = "---二级---";
		    option.value = "0";
		    listbox.options[listbox.length] = option;
		
	        listbox = document.getElementById("manuftype3");
	        listbox.length = 0;
	        var option = new Option();
	        option.text = "---三级---";
	        option.value = "0";
	        listbox.options[listbox.length] = option;		
	        
			emergyorderform.concentricityId.value = "";
			emergyorderform.manufInfo.value = "";
			emergyorderform.orderCreateDateStr.value = "";
			emergyorderform.orderCreateDateEnd.value = "";
			return false;		
		}
		else if(val=='DC')
		{
			if(pager.index != null)
			{		
				if(!isCheckBoxselected(pager,pager.index))
				{
					alert("请至少选择一笔订单！");
					return false;			
				}
				else
				{
					var icheckChar = "0123456789.";
					if(document.pager.index.length > 1)
					{
						var selectedDetailIds = document.pager.index;
						//alert("length=" + selectedDetailIds.length);
						for(i=0; i<selectedDetailIds.length;i++)
						{
							if(selectedDetailIds[i].checked)
							{
								if(isEmpty(pager.signCount[i].value))
								{
									alert("签收数量不能为空!");
									return false;
								}	
								if (isNaN(pager.signCount[i].value))
								{
									alert("签收数量请输入有效数字!");
									return false;
								}
								if(!isFloatNum(pager.signCount[i].value))
								{
									alert("请确认输入的签收数量为大于0的数字");	
									return false;
								}
								else
								{
									if(pager.signCount[i].value<=0) 
									{
										alert("签收数量必须大于0");
										return false;
									}
								}											
								if(isEmpty(pager.signPrice[i].value)){
									alert("签收价格不能为空!");
									return false;
								}
								if (isNaN(pager.signPrice[i].value))
								{
									alert("签收价格请输入有效数字!");
									return false;
								}
								if(!isFloatNum(pager.signPrice[i].value))
								{
									alert("请确认输入的签收价格为大于0的数字");	
									return false;
								}
								else
								{
									if(pager.signPrice[i].value<=0) 
									{
										alert("签收价格必须大于0");
										return false;
									}
								}
							}
						}
					}
					else
					{
						if(pager.index.checked)
						{
							if(isEmpty(pager.signCount.value))
							{
								alert("签收数量不能为空!");
								return false;
							}	
							if (isNaN(pager.signCount.value))
							{
								alert("签收数量请输入有效数字!");
								return false;
							}
							if(!isFloatNum(pager.signCount.value))
							{
								alert("请确认输入的签收数量为大于0的数字");	
								return false;
							}
							else
							{
								if(pager.signCount.value<=0) 
								{
									alert("签收数量必须大于0");
									return false;
								}
							}											
							if(isEmpty(pager.signPrice.value)){
								alert("签收价格不能为空!");
								return false;
							}
							if (isNaN(pager.signPrice.value))
							{
								alert("签收价格请输入有效数字!");
								return false;
							}
							if(!isFloatNum(pager.signPrice.value))
							{
								alert("请确认输入的签收价格为大于0的数字");	
								return false;
							}
							else
							{
								if(pager.signPrice.value<=0) 
								{
									alert("签收价格必须大于0");
									return false;
								}
							}																				
						}						
					}
					
					//保存查询参数
					pager.orderDeptId.value = emergyorderform.orderDeptId.value;
					pager.deliverGoodsId.value = emergyorderform.deliverGoodsId.value;
					pager.type.value = emergyorderform.type.value;
					pager.providerName.value = emergyorderform.providerName.value;
					pager.manuftype1.value = emergyorderform.manuftype1.value;
					pager.manuftype2.value = emergyorderform.manuftype2.value;
					pager.manuftype3.value = emergyorderform.manuftype3.value;
					pager.concentricityId.value = emergyorderform.concentricityId.value;
					pager.manufInfo.value = emergyorderform.manufInfo.value;
					pager.orderCreateDateStr.value = emergyorderform.orderCreateDateStr.value;
					pager.orderCreateDateEnd.value = emergyorderform.orderCreateDateEnd.value;					

					pager.action = "<%=response.encodeURL(root + "/A160303.do")%>";
					pager.submit();
				}
			}else{
				return false;
			}
		}
		else if(val == 'MC')
		{
			if(document.pager.index != null)
			{		
				if(!isCheckBoxselected(pager,pager.index))
				{
					alert("请至少选择一笔订单！");
					return false;			
				}
				else
				{
					var icheckChar = "0123456789.";
					if(document.pager.index.length > 1)
					{
						var selectedDetailIds = document.pager.index;
						//alert("length=" + selectedDetailIds.length);
						for(i=0; i<selectedDetailIds.length;i++)
						{
							if(selectedDetailIds[i].checked)
							{
								if(isEmpty(pager.signCount[i].value))
								{
									alert("签收数量不能为空!");
									return false;
								}	
								if (isNaN(pager.signCount[i].value))
								{
									alert("签收数量请输入有效数字!");
									return false;
								}
								if(!isFloatNum(pager.signCount[i].value))
								{
									alert("请确认输入的签收数量为大于0的数字");	
									return false;
								}
								else
								{
									if(pager.signCount[i].value<=0) 
									{
										alert("签收数量必须大于0");
										return false;
									}
								}											
								if(isEmpty(pager.signPrice[i].value)){
									alert("签收价格不能为空!");
									return false;
								}
								if (isNaN(pager.signPrice[i].value))
								{
									alert("签收价格请输入有效数字!");
									return false;
								}
								if(!isFloatNum(pager.signPrice[i].value))
								{
									alert("请确认输入的签收价格为大于0的数字");	
									return false;
								}
								else
								{
									if(pager.signPrice[i].value<=0) 
									{
										alert("签收价格必须大于0");
										return false;
									}
								}
							}
						}
					}
					else
					{
						if(pager.index.checked)
						{
							if(isEmpty(pager.signCount.value))
							{
								alert("签收数量不能为空!");
								return false;
							}	
							if (isNaN(pager.signCount.value))
							{
								alert("签收数量请输入有效数字!");
								return false;
							}
							if(!isFloatNum(pager.signCount.value))
							{
								alert("请确认输入的签收数量为大于0的数字");	
								return false;
							}
							else
							{
								if(pager.signCount.value<=0) 
								{
									alert("签收数量必须大于0");
									return false;
								}
							}											
							if(isEmpty(pager.signPrice.value)){
								alert("签收价格不能为空!");
								return false;
							}
							if (isNaN(pager.signPrice.value))
							{
								alert("签收价格请输入有效数字!");
								return false;
							}
							if(!isFloatNum(pager.signPrice.value))
							{
								alert("请确认输入的签收价格为大于0的数字");	
								return false;
							}
							else
							{
								if(pager.signPrice.value<=0) 
								{
									alert("签收价格必须大于0");
									return false;
								}
							}																				
						}						
					}
					//保存查询参数
					pager.orderDeptId.value = emergyorderform.orderDeptId.value;
					pager.deliverGoodsId.value = emergyorderform.deliverGoodsId.value;
					pager.type.value = emergyorderform.type.value;
					pager.providerName.value = emergyorderform.providerName.value;
					pager.manuftype1.value = emergyorderform.manuftype1.value;
					pager.manuftype2.value = emergyorderform.manuftype2.value;
					pager.manuftype3.value = emergyorderform.manuftype3.value;
					pager.concentricityId.value = emergyorderform.concentricityId.value;
					pager.manufInfo.value = emergyorderform.manufInfo.value;
					pager.orderCreateDateStr.value = emergyorderform.orderCreateDateStr.value;
					pager.orderCreateDateEnd.value = emergyorderform.orderCreateDateEnd.value;					
					
					pager.action = "<%=response.encodeURL(root + "/A160304.do")%>";
					pager.submit();
				}
			}
			else
			{
				return false;
			}
		}
		else if(val == 'D')
		{
			if(document.pager.index != null)
			{		
				if(!isCheckBoxselected(pager,pager.index))
				{
					alert("请至少选择一笔订单！");
					return false;			
				}else{
					var count = 0;
					var temp = "";
					var type = "";
					if(document.pager.index.length > 1){
						for(i=0; i<pager.index.length;i++){
							if(pager.index[i].checked){
								if(pager.deliverGoodsIds[i].value == temp){
									if(pager.orderType[i].value != type){
										alert("同一出货单号中只能删除类型为'补单'的数据!");
										return false;
									}
								}else{
									temp = pager.deliverGoodsIds[i].value;
									type = pager.orderType[i].value;
								}
							}
						}
					}else{
						if(pager.index.checked){
							if(pager.deliverGoodsIds.value == temp){
								if(pager.orderType.value != type){
									alert("同一出货单号中只能删除类型为'补单'的数据!");
									return false;
								}
							}else{
								temp = pager.deliverGoodsIds.value;
								type = pager.orderType.value;
							}																			
						}					
					}
					if(confirm("是否确定删除?")){
						//保存查询参数
						pager.orderDeptId.value = emergyorderform.orderDeptId.value;
						pager.deliverGoodsId.value = emergyorderform.deliverGoodsId.value;
						pager.type.value = emergyorderform.type.value;
						pager.providerName.value = emergyorderform.providerName.value;
						pager.manuftype1.value = emergyorderform.manuftype1.value;
						pager.manuftype2.value = emergyorderform.manuftype2.value;
						pager.manuftype3.value = emergyorderform.manuftype3.value;
						pager.concentricityId.value = emergyorderform.concentricityId.value;
						pager.manufInfo.value = emergyorderform.manufInfo.value;
						pager.orderCreateDateStr.value = emergyorderform.orderCreateDateStr.value;
						pager.orderCreateDateEnd.value = emergyorderform.orderCreateDateEnd.value;					
					
						pager.action = "<%=response.encodeURL(root + "/A160305.do")%>";
						pager.submit();									
					}else{
						return false;
					}
				}
			}			
		}   
	}     

	function control(val){
			if(val == 'requery'){
				<%
					if(isRequery != null && isRequery.equals("true")){
				%>
				emergyorderform.action = "<%=response.encodeURL(root + "/A160302.do")%>";
	    		emergyorderform.submit();		
				<%		
					}
				%>
			}
	}	

	function checkDeliverGoodsId(){
		var delivergoodsid = document.getElementById("deliverGoodsId").value;

		if (delivergoodsid == "" || delivergoodsid == null || isEmpty(delivergoodsid)){
			document.getElementById("delivergoodsid").value = "";
			return false;	
		}
		document.all('iframe1').src="<%=response.encodeURL(root+"/jsp/iframe/checkdelivergoodsid_.jsp")%>?&delivergoodsid="+delivergoodsid;
		document.getElementById("type").focus();
	}
</script>
	</head>
	<body BGCOLOR="#f2f2f2" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="control('requery')">
		<form name="emergyorderform" method="get">
			<p><FONT face="宋体"></FONT><FONT face="宋体"></FONT><FONT face="宋体"></FONT><br>
			</p>
			<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
				<tr>
					<td height="20">
						<table width="100%" border="0" cellspacing="0" cellpadding="1">
							<tr height="20">
								<td height="30" width="758" class="mtxt_black">应急采购确认
								</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td class="bg_line" height="2"></td>
				</tr>
			</table>
			<br>
			<table class="bg_table" id="Table1" cellspacing="1" cellpadding="0" style="PADDING-RIGHT:5px; PADDING-LEFT:5px"
				width="98%" align="center" border="0">
				<TR height="20">
					<TD class="bg_column" align="center" width="15%">订货单位</TD>
					<TD class="bg_row_odd" width="35%">
						<select name="orderDeptId">					
						<option value="0000">---全部---</option>
						<%
							String tOrderDept = request.getParameter("orderDeptId");
							if(tOrderDeptList != null && tOrderDeptList.size() > 0 ){	
							    if(tOrderDept != null && tOrderDept.equals("0000")){
									for(int i=0; i<tOrderDeptList.size(); i++){
									    String[] temp = (String[])tOrderDeptList.get(i);
						%>
										<option value="<%=temp[0]%>"><%=temp[1]%></option>						
						<%			    
									}
							    }else{
									for(int i=0; i<tOrderDeptList.size(); i++){
									    String[] temp = (String[])tOrderDeptList.get(i);
										if(tOrderDept != null && tOrderDept.equals(temp[0])){
							%>
											<option value="<%=temp[0]%>" selected>
											<%=temp[1]%></option>
							<%				    
										}else{
							%>
											<option value="<%=temp[0]%>"><%=temp[1]%></option>
							<%			
										}
									}
							    }
							}

						%>

						</select>
					</TD>
					<TD class="bg_column" align="center" width="15%">送货单号</TD>
					<TD align="left" class="bg_row_odd" width="35%">
						<INPUT type="text" ID="deliverGoodsId" NAME="deliverGoodsId" maxlength="20" value="<%=request.getParameter("deliverGoodsId")==null?"":request.getParameter("deliverGoodsId")%>" onKeyUp="if(event.keyCode==13){ checkDeliverGoodsId(); }">
						&nbsp;
						<input type=button class=kuang value='送货单号检查' onClick='checkDeliverGoodsId()'>
					</TD>
				</TR>
				<TR height="20">
					<TD class="bg_column" align="center">类型</TD>
					<TD align="left" class="bg_row_odd">
						<select ID="type" NAME="type">
							<option value="0">---全部---</option>
							<%
								String type = request.getParameter("type");
								String[][] tType = com.hitrust.gs.service.GSBaseManager.getAllEmergencyOrderType();
								for(int i=0; i<tType.length; i++){
								    String[] tVal = tType[i];
								    if(type != null && !type.equals("0") && type.equals(tVal[0])){
							%>
							<option value="<%=tVal[0] %>" selected><%=tVal[1]%></option>
							<%	        
								    }else{
							%>		        
							<option value="<%=tVal[0] %>"><%=tVal[1]%></option>								        
							<%	
								    }
								}
							%>
						</select>
					</TD>
					<TD class="bg_column" align="center">供应商</TD>
					<TD class="bg_row_odd" align="left">
					<input type="text" name="providerName" value="<%=request.getParameter("providerName")==null? "":request.getParameter("providerName") %>" maxlength="100">				
					</TD>
				</TR>
				<TR height="20">
					<TD class="bg_column" align="center">产品分类</TD>
					<TD left="right" class="bg_row_odd" colspan="3">
				      <select name="manuftype1" onChange="change1(this.value)">
				        <option value="0">---一级---</option>
				        <%
				        String tManufType1 = request.getParameter("manuftype1");
				        if (tManuf1 != null && tManuf1.size() > 0) {
				          for (int i = 0; i < tManuf1.size(); i++) {
				            GSManufactureCategoryBean tGSManufactureBean = (GSManufactureCategoryBean) tManuf1.get(i);
				            if (tManufType1 != null && tManufType1.equals(tGSManufactureBean.getGs_manufacture_category_id())) {
				              %>
				              <option value="<%=tGSManufactureBean.getGs_manufacture_category_id()%>" selected><%=tGSManufactureBean.getGs_manufacture_category_name()%>        </option>
				              <%} else {      %>
				              <option value="<%=tGSManufactureBean.getGs_manufacture_category_id()%>"><%=tGSManufactureBean.getGs_manufacture_category_name()%>        </option>
				              <%
				              }
				            }
				          }
				          %>
				      </select>
				      <select id="manuftype2" name="manuftype2" onChange="change2(this.value)">
				        <option value="0">---二级---</option>
				        <%
				        String tManufType2 = request.getParameter("manuftype2");
				        if (tManufType1 != null && !tManufType1.equals("0")) {
				          ArrayList temp = (ArrayList) tMap1.get(tManufType1);
				          if (temp != null && temp.size() > 0) {
				            for (int i = 0; i < temp.size(); i++) {
				              GSManufactureCategoryBean tGSManuf2 = (GSManufactureCategoryBean) temp.get(i);
				              if (tManufType2 != null && tManufType2.equals(tGSManuf2.getGs_manufacture_category_id())) {
				                %>
				                <option value="<%=tManufType2%>" selected><%=tGSManuf2.getGs_manufacture_category_name()%>        </option>
				                <%} else {      %>
				                <option value="<%=tGSManuf2.getGs_manufacture_category_id()%>"><%=tGSManuf2.getGs_manufacture_category_name()%>        </option>
				                <%
				                }
				              }
				            }
				          }
				          %>
				      </select>
				      <select name="manuftype3" id="manuftype3">
				        <option value="0">---三级---</option>
				        <%
				        String tManufType3 = request.getParameter("manuftype3");
				        if (tManufType2 != null && !tManufType2.equals("0")) {
				          //int tIntManufType3 = Integer.parseInt(tManufType3);
				          ArrayList temp = (ArrayList) tMap2.get(tManufType2);
				          if (temp != null && temp.size() > 0) {
				            for (int i = 0; i < temp.size(); i++) {
				              GSManufactureCategoryBean tGSManuf3 = (GSManufactureCategoryBean) temp.get(i);
				              if (tManufType3 != null && tManufType3.equals(tGSManuf3.getGs_manufacture_category_id())) {
				                %>
				                <option value="<%=tGSManuf3.getGs_manufacture_category_id()%>" selected><%=tGSManuf3.getGs_manufacture_category_name()%>        </option>
				                <%} else {      %>
				                <option value="<%=tGSManuf3.getGs_manufacture_category_id()%>"><%=tGSManuf3.getGs_manufacture_category_name()%>        </option>
				                <%
				                }
				              }
				            }
				          }
				          %>
				      </select>							</TD>
				</TR>
				<tr>
					<TD class="bg_column" align="center">集中编码</TD>
					<TD align="left" class="bg_row_odd" colspan="3">
					<input type="text" name="concentricityId" maxlength="20" value="<%=request.getParameter("concentricityId")==null?"":request.getParameter("concentricityId")%>">
					</TD>
				</tr>
				<tr>
					<TD class="bg_column" align="center">产品信息</TD>
					<TD class="bg_row_odd" colspan="3">
					<input type="text" name="manufInfo" maxlength="200" value="<%=request.getParameter("manufInfo")==null?"":request.getParameter("manufInfo")%>">（<FONT color="#ff0033">对产品名称、型号、规格、品牌、生产厂商、附加属性等关键字的模糊查询</FONT>）&nbsp;
					</TD>
				</tr>
         <%
        SimpleDateFormat bartDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        Date d = new Date();
        String strNow = String.valueOf(bartDateFormat.format(d));
        long l=(long)259200*(long)10000;
        Date d2 = new Date(System.currentTimeMillis()-l);
        String strMothAgo = String.valueOf(bartDateFormat.format(d2));
        %>        
				<TR height="20">
					<TD class="bg_column" align="center">创建时间</TD>
					<TD align="left" class="bg_row_odd" colspan="3">
					<input type="text"	name="orderCreateDateStr" value="<%=request.getParameter("orderCreateDateStr")==null?strMothAgo:request.getParameter("orderCreateDateStr")%>" length="20" onfocus="setday(this)" readonly> 
					～<input type="text"	name="orderCreateDateEnd" length="20" value="<%=request.getParameter("orderCreateDateEnd")==null?strNow:request.getParameter("orderCreateDateEnd")%>" onfocus="setday(this)" readonly>
					</TD>
				</TR>
                <%
                if(tOrder != null) {
                    int totalRecords = 0;
                    if(request.getAttribute("totalRecords")!=null){
                        totalRecords=Integer.parseInt((String)request.getAttribute("totalRecords"));
                    }
                    int defaultPageSize =10;
                    if(request.getAttribute("pageSize")!=null){
                        defaultPageSize=Integer.parseInt((String)request.getAttribute("pageSize"));
                    }

                %>          
                <page:pager total='<%=totalRecords%>' defaultPageSize='<%=defaultPageSize%>'></page:pager>
                <%} %>
			</table>
		</form>
		<p align="center">
		<input type="button" name="查询" value="查询" class="kuang" onclick="process('Q')"/>&nbsp;
		<input type="button" name="清空" value="清空" class="kuang" onclick="process('C')"/>&nbsp;
		</p>
		<center>
		<%
			if(tOrder != null){
		%>
			<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
				<tr>
					<td>
            <%
			tList = tOrder.getAllRecoreds();
			double totSum = 0;
			for(int i=0; i < tList.size();i++){
				String[] temp = (String[])tList.get(i);
				totSum = totSum + Double.parseDouble(temp[13]) * Double.parseDouble(temp[14]);
			} 			
			%>			
 			<form name='pager' method="post">
              <input type="hidden" name="orderDeptId" >     			
              <input type="hidden" name="deliverGoodsId" >     			
              <input type="hidden" name="type" >     			
              <input type="hidden" name="providerName" >     			
              <input type="hidden" name="manuftype1" >     				
              <input type="hidden" name="manuftype2" >     				
              <input type="hidden" name="manuftype3" >     				
              <input type="hidden" name="concentricityId" >     				
              <input type="hidden" name="manufInfo" >     				
              <input type="hidden" name="orderCreateDateStr" >     				
              <input type="hidden" name="orderCreateDateEnd" >     							            	
							<table class="bg_table" id="tableId" cellspacing="1" cellpadding="2" width="100%" align="center"
								border="0">
								<tbody>
									<tr class="bg_column" height="20">
										<td class="top" colspan="18" nowrap="true">
											<div align="center"><b>应急采购信息列表</b></div>
											<div id="totalSum" align="right">总价:<%=StringUtils.formatEDouble(totSum,4)%></div>
										</td>
									</tr>
									<%
										if(tList != null && tList.size() > 0){
									%>
									<tr class="bg_column" height="20">
								    <td width="960" height="16" colspan="18" align="right">
											<!--导航条-->
								    		<page:navigator type='text' queryForm="emergyorderform"/>
								    </td>									
								    </tr>
								    <%} %>
									<tr class="bg_column" height="20">
										<td class="top" align="center">
											<div align="center" class="txt_content"><INPUT type="checkbox" ID="Checkbox8" NAME="indexs" onClick="SelectAllCheckBox(pager,'index')"></div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content">送货单号</div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content">类型</div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content">订货单位</div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content">集中编码</div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content">产品名称</div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content">是否交易平台产品</div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content">规格</div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content">型号</div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content">品牌</div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content">供应商</div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content">订货数量</div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content">设定价格<br>
												（元）</div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content">签收数量</div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content">签收价格<br>
												（元）</div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content">签收总价<br>
												（元）</div>
										</td>
                                        <td class="top" align="center">
                                            <div align="center" class="txt_content">结算模式</div>
                                        </td>										
										<td class="top" align="center">
											<div align="center" class="txt_content">详细</div>
										</td>
									</tr>
									<%
										if(tList != null && tList.size() > 0){
										    for(int i=0; i<tList.size(); i++){
										        String[] tStr = (String[])tList.get(i);
												String tTempStr="";
												if(i%2==0){
													tTempStr="bg_row_odd";
												}else {
													tTempStr="bg_row_even";
												}										        
									%>
									<tr class="<%=tTempStr%>" height="20">
										<td class="top" align="center">
											<div align="center" class="txt_content"><INPUT type="checkbox" NAME="index" value="<%=tStr[17]%>"></div>
											<input type="hidden" name="orderDetailIds" value="<%=tStr[17]%>">											
											<input type="hidden" name="orderIds" value="<%=tStr[18]%>">
											<input type="hidden" name="deliverGoodsIds" value="<%=tStr[0]%>">
											<input type="hidden" name="isTradeFlatProvider" value="<%=tStr[15]%>">
											<input type="hidden" name="isTradeFlatManuf" value="<%=tStr[5]%>">			
											<input type="hidden" name="orderType" value="<%=tStr[1]%>">
											<input type="hidden" name="orgSignPrice" value="<%=tStr[14]%>">											
											<input type="hidden" name="orgSignCount" value="<%=tStr[13]%>">
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content"><%=tStr[0] %></div><!-- 出货单号-->
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content"><%=GSBaseManager.getEmergencyOrderTypeName(tStr[1]) %></div> <!-- 类型 -->
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content"><%=tStr[2] %></div><!-- 订货单位 -->
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content"><%=tStr[3] %></div><!-- 集中编码 -->
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content">
											<A href="<%=response.encodeURL(root + "/A150103.do?&concentricityId=" + tStr[3])%>" target="_blank"><%=tStr[4]%></A><!-- 产品名称 -->
											</div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content"><%=GSBaseManager.getIsTradeManuf(tStr[5])%></div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content"><%=tStr[6]%></div><!-- 规格 -->
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content"><%=tStr[7]%></div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content"><%=tStr[8]%></div>
										</td>
										<td class="top" align="center">
										<%
											String temp = "";
											if(tStr[5].equals("0") && tStr[15].equals("0")){
											    temp = "(采购网配送)";
											}
										%>
											<div align="center" class="txt_content"><a href="<%=response.encodeURL(root + "/A400108.do?providerId=" + tStr[16]) %>" target="_blank"><%=tStr[9]%></a><%=temp%></div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content"><%=tStr[10]+tStr[11] %></div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content"><%=tStr[12]%></div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content">
											<INPUT id="signCount<%=i%>" type="text" size="6" onKeyUp="calculate2('signCount','signPrice',sum<%=i%>,<%=i%>,<%=tList.size()%>)" maxlength="15" value="<%=tStr[13]%>" name="signCount"><%=tStr[11]%></div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content">
											<INPUT id="signPrice<%=i%>" type="text" maxlength="15" onKeyUp="calculate2('signCount','signPrice',sum<%=i%>,<%=i%>,<%=tList.size()%>)" name="signPrice" size="6" value="<%=tStr[14]%>" ></div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content" id="sum<%=i%>">
											<%=StringUtils.formatEDouble(Double.parseDouble(tStr[13])*Double.parseDouble(tStr[14]),4)%>
											</div>
										</td>	
                                        <td class="top" align="center">
                                            <div align="center" class="txt_content"><%=DefineDic.getBalanceMode(tStr[19])%></div>
                                        </td>									
										<td class="top" align="center">
											<div align="center" class="txt_content">
											<a href="<%=response.encodeURL(root+"/A160306.do")%>?orderId=<%=tStr[18]%>&orderDetailId=<%=tStr[17]%>&deliverGoodsId=<%=tStr[0]%>" target="_blank">详细</A></div>
										</td>
									</tr>
									<%
										    }
									%>
									<tr class="bg_column" height="20">
								    <td width="960" height="16" colspan="18" align="right">
											<!--导航条-->
								    		<page:navigator type='text' queryForm="emergyorderform"/>
								    </td>
								    </tr>
							    <%
									}else{
								%>
										<font color="red">没有符合条件的订单信息</font>
								<%
									}
								%>
								    
								</tbody>
							</table>
				</form>							
					</td>
				</tr>
			</table>
		</center>
			<p align="center">
				<tr>
					<td align="center">
						<INPUT type="button" value="直接确认" class="kuang" onClick="process('DC')">&nbsp; 
						<INPUT type="button" value="调整确认" class="kuang" onClick="process('MC')">&nbsp;
						<INPUT type="button" value="删除" class="kuang" onClick="process('D')"><br>
						<br>
					</td>
				</tr>
				</p>			
			<%
				}
				if(tOrder == null && isRequery != null && isRequery.equals("true")){
		    %>
		    	<font size="2">数据查询中......</font>
		    <%
		    	}
		    %>						
	</body>
<script>
	function calculate2(fcount,fprice,fresult,index,num){
		amt = 0.0;
		var f1 = document.getElementById(fcount+index);
		var f2 = document.getElementById(fprice+index);
		if(isEmpty(f1.value)){
			alert("签收数量不能为空!");
			//document.all.fcount.focus();
			return false;
		}
		if(isEmpty(f2.value)){
			alert("签收价格不能为空!");
			//document.all.fcount.focus();
			return false;
		}		
		if(isNaN(f1.value)){
			alert("签收数量必须为数字（包含小数）!");
			//document.all.fcount.focus();			
			return false;		
		}	
		if(isNaN(f2.value)){
			alert("签收价格必须为数字（包含小数）!");
			//document.all.fcount.focus();			
			return false;		
		
		}
		var val = parseFloat(f1.value,10);
		var temp = fprice + "0";
		var price = parseFloat(f2.value,1);
		amt =  val * price;
		amt = Math.round(amt * 10000)/10000;
		fresult.innerText = amt;
		calTotalSum(fcount,fprice,num);
	}
	function calTotalSum(fcount,fprice,num){
		var totsum = 0;
		for(var j=0; j<num;j++){
			var count = document.getElementById(fcount+j);
			var price = document.getElementById(fprice+j);
			totsum = totsum + parseFloat(count.value)*parseFloat(price.value);
		}		
		totalSum.innerText = "总价:"+ Math.round(totsum * 10000)/10000;
	}
</script>
<iframe id='iframe1' name="iframe1" src="<%=response.encodeURL(root+"/template.jsp")%>" width="0" height="0" frameborder = "0"></iframe>
</html>